import Vue from 'vue'

import Cookies from 'js-cookie'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
import Element from 'element-ui'
import './styles/element-variables.scss'
import '@/styles/index.scss' // global css
import './styles/components.scss'
import App from './App'
import store from './store'
import router from './router'
import 'element-ui/lib/theme-chalk/display.css';

import './icons' // icon
import './permission' // permission control
import './utils/error-log' // error log

import * as filters from './filters' // global filters

import dataV from '@jiaminghi/data-view'

Vue.use(dataV)
Vue.config.productionTip = false

import echarts from 'echarts'

Vue.prototype.$echarts = echarts
Vue.prototype.$echartsResize = function(ref) {
  window.addEventListener('resize', function() {
    ref.resize()
  })
}
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online! ! !
 */

import global_variable from '@/utils/global_variable'
// import { mockXHR } from '../mock'
// if (process.env.NODE_ENV === 'production') {
//   mockXHR()
// }

Vue.use(Antd)

Vue.use(Element, {
  size: Cookies.get('size') || 'mini' // set element-ui default size
})

// register global utility filters
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

Vue.prototype.GLOBAL = global_variable

// 拖拽、缩放、画布插件
import './utils/directives.js';

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
